#include <iostream>
#include <chrono>
#include <random>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#define VNAME(name) (#name)
#define debug(x) {auto debugx = x; std::cout << " (" << VNAME(x) << ": " << (debugx) << ")" << endl;}
#define F_(n) cout << fixed << setprecision(n)
#ifndef ONLINE_JUDGE
#else
	#define endl '\n'
#endif
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
bool _OJ_Flag = true;
static int __ = []() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    return 0;
}();//*/
int go[N];
const double ipi = sqrt(3.0);
string solve(int n) {
    string s(""), yyc("yy");debug(n);
    if (n <= 10) {
        s = "yy";
        for (int i = 1; i <= n; ++ i) s.append("c");
        return s;
    }
    
    int nn = pow(n, 0.34), yy = n / nn;
    int gs = upper_bound(go + 1, go + 20000, yy) - go - 1;
    for (int i = 3; i <= gs; ++ i) s.append("y");
    for (int i = 1; i <= nn; ++ i) s.append("c");
    //debug(go[gs] * nn);
    for (int i = n - go[gs] * nn; i; -- i) {
        yyc.append("c"); //debug(i);
    }
    return yyc + s;
}
signed main() {
    #ifndef ONLINE_JUDGE
		_OJ_Flag = false; //freopen("C:\\Users\\lenovo\\Desktop\\in.in", "r", stdin);
	#endif
    int t = 1;
    cin >> t;
    for (int i = 2; i < 20000; ++ i) go[i] = go[i - 1] + i - 1;
    //cout << go[10000 - 1] << endl;
    while (t --) {
        int n, k;
        cin >> n;
        string s = solve(n);
        cout << s.length() << '\n' << s << endl;
        //debug(solve(n));
    }
    #ifndef ONLINE_JUDGE
		system("pause");
	#endif
    return 0;
}